package com.cennavi.minemap.util;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FileUtil {

	public static void mkdir(String path) {
		File file = new File(path);
		if (!file.exists() && !file.isDirectory()) {
			file.mkdirs();
		}
	}
	
	public static List<String> getFileList(String path , String fileSufFix , String fileLastFix){
		List<String> fileList = new ArrayList<>();
		File file = new File(path);
		if (!file.exists() || !file.isDirectory()){
			return null;
		}
		
		String[] filenames = file.list();
		
		for (String filename : filenames){
			File tfile = new File(path + filename);
			if (!tfile.isFile()){
				continue;
			}
		    if (filename.indexOf(fileSufFix) == 0 && filename.indexOf(fileLastFix) > -1){
		    	fileList.add(path + filename);
		    }
		}
		return fileList;
	}
}
